import request   from "@/utils/http";

/**
 * 获取购物车列表
 */
export const getCartsAPI = () => {
	return request({
	  url: "/member/cart",
	 
	});
};


/**
 * 加入购物车
 */
export const addCartAPI = (skuId, count) => {
	return request({
	  url: "/member/cart",
	  method: "post",
	  data: { skuId, count },
	});
};
// 修改购物车单品
export const updateCartAPI = (skuId, data) => {
	return request({
	  url: `/member/cart/${skuId}`,
	  method: "PUT",
	  data
	});
};
  
// 修改购物车单品
export const memberCartSelected = (selected) => {
	return request({
	  url: `/member/cart/selected`,
	  method: "PUT",
	  data:{ selected }
	});
};
  


// 删除/清空购物车单品
export const delCartByIdAPI = (ids) => {
	return request({
		url: `/member/cart`,
		method: "delete",
		data: { ids },
	});

}

/**
 * 获取预付订单(填写订单)
 */
export const getPreOrderPreAPI = () => {
	return request({
	  url:`/member/order/pre`,
	});
};
  
/**
 * 提交订单
 */
export const createOrderAPI = (data) => {
	return request({
	  url: "/member/order",
	  method: "POST",
	  data,
	});
};
  
/**
 * 获取订单详情
 */
export const geOrderDetailAPI = (id) => {
	return request({
	  url: `/member/order/${id}`,
	});
};
  
/**
 * 支付-微信-小程序
 */
export const getPayWxPayMiniPay = (orderId) => {
	return request({
	  url: `/pay/wxPay/miniPay`,
	  data: { orderId },
	});
  };